using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ShowCanvas : MonoBehaviour
{
    public Canvas mainPanel;
    CanvasGroup canvasGroup;
    void Awake()
    {
        canvasGroup = this.GetComponent<CanvasGroup>();
        if (mainPanel.enabled)
        {
            canvasGroup.alpha = 1;
        }
    }
    void Update()
    {
        if (mainPanel.enabled && canvasGroup.alpha < 0.01f)
        {
            canvasGroup.alpha = 1;
        }
        else if (!mainPanel.enabled && canvasGroup.alpha > 0.99f)
        {
            canvasGroup.alpha = 0;
        }
    }
}
